import request from '@/config/axios'

// 通信行为 VO
export interface CommunicateVO {
  id: number // ID
  ipAddress: string // IP地址
  upStream: number // 上行流量
  downStream: number // 下行流量
  successConnection: number // 成功连接数
  errorConnection: number // 失败连接数
  deviceStatus: string // 是否异常通信
}

// 通信行为 API
export const CommunicateApi = {
  // 查询通信行为分页
  getCommunicatePage: async (params: any) => {
    return await request.get({ url: `/security/communicate/page`, params })
  },

  // 查询通信行为详情
  getCommunicate: async (id: number) => {
    return await request.get({ url: `/security/communicate/get?id=` + id })
  },

  // 新增通信行为
  createCommunicate: async (data: CommunicateVO) => {
    return await request.post({ url: `/security/communicate/create`, data })
  },

  // 修改通信行为
  updateCommunicate: async (data: CommunicateVO) => {
    return await request.put({ url: `/security/communicate/update`, data })
  },

  // 删除通信行为
  deleteCommunicate: async (id: number) => {
    return await request.delete({ url: `/security/communicate/delete?id=` + id })
  },

  // 导出通信行为 Excel
  exportCommunicate: async (params) => {
    return await request.download({ url: `/security/communicate/export-excel`, params })
  },
}